<%@ page contentType="text/html;charset=UTF-8" pageEncoding="UTF-8" language="java" %>
<%@ page import="cn.medemede.model.UsersBean" %>
<html>
<head>
    <meta http-equiv="content-type" content="text/html; charset=utf-8" />
    <script type="text/javascript" src="https://cdn.staticfile.org/jquery/3.2.1/jquery.min.js"></script>
    <!-- 最新版本的 Bootstrap 核心 CSS 文件 -->
    <link rel="stylesheet" href="https://cdn.bootcss.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">

    <!-- 可选的 Bootstrap 主题文件（一般不用引入） -->
    <link rel="stylesheet" href="https://cdn.bootcss.com/bootstrap/3.3.7/css/bootstrap-theme.min.css" integrity="sha384-rHyoN1iRsVXV4nD0JutlnGaslCJuC7uwjduW9SVrLvRYooPp2bWYgmgJQIXwl/Sp" crossorigin="anonymous">

    <!-- 最新的 Bootstrap 核心 JavaScript 文件 -->
    <script src="https://cdn.bootcss.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
    <style>
        body
        {
            background:
                    radial-gradient(black 15%, transparent 16%) 0 0,
                    radial-gradient(black 15%, transparent 16%) 8px 8px,
                    radial-gradient(rgba(255,255,255,.1) 15%, transparent 20%) 0 1px,
                    radial-gradient(rgba(255,255,255,.1) 15%, transparent 20%) 8px 9px;
            background-color:#282828;
            background-size:16px 16px;

        }
    </style>
    <title>Title</title>
</head>
    <body style="padding-top: 70px">
<%  request.setCharacterEncoding("utf-8");
    response.setContentType("text/html;charset=UTF-8");
    UsersBean user= (UsersBean) session.getAttribute("user");
%>
<nav class="navbar navbar-default navbar-fixed-top">
    <div class="container">
        <div class="navbar-header">
            <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
            </button>
            <a class="navbar-brand" href="index.jsp"><strong>学生信息管理系统</strong></a>
        </div>
        <div class="navbar-right">
            <p class="navbar-text">【<%=user.getCharacter()%>】 <a href="log_suc.jsp" class="navbar-link"><%=user.getZname()%></a></p>
            <button type="button" class="btn btn-default navbar-btn " onclick="check()">注销</button>
        </div>
    </div>
</nav>

<div class="container" style="background-color: #f5f5f5;margin: 20px auto auto auto">
    <div class="page-header" style="text-align: center">
        <h2>个人资料</h2>
    </div>
    <div class="panel panel-default">
        <div class="panel-body">
            <table class="table table-striped table-hover" style="text-align: center;margin: 20px auto;" >
                <tr>
                    <td height="50px" width="30%"><h3>姓名</h3></td>
                    <td width="70%" ><h3><%=user.getZname()%></h3></td>
                </tr>
                <tr>
                    <td height="50px"><h3>性别</h3></td>
                    <td><h3><%=user.getSex()%></h3></td>
                </tr>
                <tr>
                    <td height="50px"><h3>年龄</h3></td>
                    <td><h3><%=user.getAge()%></h3></td>
                </tr>
                <tr>
                    <td height="50px"><h3>出生日期</h3></td>
                    <td><h3><%=user.getBorth()%></h3></td>
                </tr>
                <tr>
                    <td height="50px"><h3>地区</h3></td>
                    <td><h3><%=user.getZposition()%></h3></td>
                </tr>
                <tr>
                    <td height="50px"><h3>爱好</h3></td>
                    <td><h3><%=user.getFavorite()%></h3></td>
                </tr>
                <tr>
                    <td height="50px"><h3>联系方式</h3></td>
                    <td><h3><%=user.getPhone()%></h3></td>
                </tr>
                <tr>
                    <td height="50px"><h3>Email</h3></td>
                    <td><h3><%=user.getEmail()%></h3></td>
                </tr>
                <tr>
                    <td colspan="2"><button type="button" class="btn btn-primary btn-lg" style="margin-right: 20px" onclick="location='change.jsp'">修改</button>
                        <button type="button" class="btn btn-primary btn-lg" style="margin-left: 20px" onclick="check()">注销</button></td>
                </tr>
            </table>
        </div>
    </div>
</div>

<script>
    function check() {
        if (confirm("注销?")){
            $.post("/javaweb/JServlet",{
                    actionName:"clear"},
                function (data) {
                    if (data.search("clearSuc")!==-1){
                        window.location.href="index.jsp";
                    }else {
                        alert("对不起，注销失败！请重试。");
                    }
                }
            );
        }
    }
</script>
</body>
</html>
